<template>
  <a-modal
    :visible="visible"
    :title="title"
    okText='提交审核'
    cancelText='关闭'
     :width="1600"
    :bodyStyle="{
      height: '500px',
      overflow: 'auto'
    }"
    @cancel="() => { $emit('cancel') }"
    @ok="handleSave"
  >
  <detail-list :col="3">
      <detail-list-item term="学号">{{ info.xht }}&nbsp;</detail-list-item>
      <detail-list-item term="姓名">{{ info.xsxx.xm }}&nbsp;</detail-list-item>
      <detail-list-item term="院系">{{ info.xsxx.xjxx.ssyxmc }}&nbsp;</detail-list-item>
      <detail-list-item term="专业">{{ info.xsxx.xjxx.sszymc }}&nbsp;</detail-list-item>
      <detail-list-item term="入学年月">{{ info.xsxx.xjxx.rxny.split(' ')[0] }}&nbsp;</detail-list-item>
      <detail-list-item term="导师姓名">{{ info.xsxx.xjxx.dsxm }}&nbsp;</detail-list-item>
      <detail-list-item term="培养层次">{{ info.xsxx.xjxx.pyccmc }}&nbsp;</detail-list-item>
      <detail-list-item term="学生联系方式">{{ info.xsxx.lxdh }}&nbsp;</detail-list-item>
      <detail-list-item term="出生日期">{{ info.xsxx.csrq }}&nbsp;</detail-list-item>
      <detail-list-item term="出生地">{{ info.xsxx.csdcdmc }}&nbsp;{{ info.xsxx.csdxqdmc }}&nbsp;</detail-list-item>
      <detail-list-item term="性别">{{ info.xsxx.xbmc }}&nbsp;</detail-list-item>
      <detail-list-item term="政治面貌">{{ info.xsxx.zzmmmc }}&nbsp;</detail-list-item>
      <detail-list-item term="民族">{{ info.xsxx.mzmc }}&nbsp;</detail-list-item>
      <detail-list-item term="所属学科">{{ info.xsxx.xjxx.xkmc }}&nbsp;</detail-list-item>
      <detail-list-item term="导师联系方式">{{ info.xsxx.xjxx.dslxdh }}&nbsp;</detail-list-item>
      <detail-list-item term="项目申报年级">{{ info.xmsbnj }}&nbsp;</detail-list-item>
      <detail-list-item term="项目申报名称">{{ info.projectName }}&nbsp;</detail-list-item>
       <detail-list-item v-if="info.sblx" term="项目申报类型">{{ info.sblxmc }}&nbsp;</detail-list-item>
       <detail-list-item v-if="info.nfxsj" term="拟访学时间">{{ info.nfxsj.format('YYYY-MM-DD') }}&nbsp;</detail-list-item>
       <detail-list-item v-if="info.nsqfxjgzw" term="拟申请访学机构(中文)">{{ info.nsqfxjgzw }}&nbsp;</detail-list-item>
       <detail-list-item v-if="info.nsqfxjgyw" term="拟申请访学机构(英文)">{{ info.nsqfxjgyw }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.nsqfxxkzw" term="拟申请访学学科(中文)">{{ info.nsqfxxkzw }}&nbsp;</detail-list-item>
       <detail-list-item v-if="info.nsqfxxkyw" term="拟申请访学学科(英文)">{{ info.nsqfxxkyw }}&nbsp;</detail-list-item>
       <detail-list-item v-if="info.gwdsxm" term="国（境）外导师姓名">{{ info.gwdsxm }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.gwdszc" term="国（境）外导师职称">{{ info.gwdszc }}&nbsp;</detail-list-item>
       <detail-list-item v-if="info.gwdslxfs" term="国（境）外导师联系方式">{{ info.gwdslxfs }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.khfsmc" term="外语水平考核方式">{{ info.khfsmc }}&nbsp;</detail-list-item>
       <detail-list-item v-if="info.wycj" term="外语水平成绩">{{ info.wycj }}&nbsp;</detail-list-item>
       <detail-list-item v-if="info.hymczw" term="会议名称(中文)">{{ info.hymczw }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.hymcyw" term="会议名称(英文)">{{ info.hymcyw }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.hyxs" term="参会形式">{{ info.hyxs=='ktbg'?'口头报告':'张贴海报' }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.tm" term="(口头报告/张贴海报)题目">{{ info.tm }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.hyzbfqc" term="会议主办方全称">{{ info.hyzbfqc }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.hywz" term="会议网址">{{ info.hywz }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.hydd" term="会议地点（国家、城市、详细地点）">{{ info.hydd }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.hysj" term="会议时间（与邀请函保持一致）">{{ info.hysj.format('YYYY-MM-DD') }}&nbsp;</detail-list-item>

        <detail-list-item v-if="info.gjfy" term="国际旅费">{{ info.gjfy }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.hyzcf" term="会议注册费">{{ info.hyzcf }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.yszje" term="预算总金额">{{ info.yszje }}&nbsp;</detail-list-item>
    </detail-list>
        <a-row style="padding-bottom:16px" v-if="info.coursewareLis && info.coursewareLis.length">
         <a-col :span="24">
           <div class="term" style="color: rgba(0, 0, 0, 0.85)">学习工作简历（自高中刚毕业后）:</div>
           <div class="content" v-for="(item,i) in info.xxgjjlList" v-if="item.kssj && item.jssj" :key="item.id">{{i+1}}.{{item.kssj}}~{{item.jssj}}{{item.xxggdw}}</div>
           <div class="content" v-else>无</div>
         </a-col>
       </a-row>
        <a-row style="padding-bottom:16px" v-if="info.bsjdkexxxqk">
         <a-col :span="24">
           <div class="term" style="color: rgba(0, 0, 0, 0.85)">博士阶段课程学习情况、科研情况、发表文章及自我综合评价:</div>
           <div class="content" >{{ info.bsjdkexxxqk }}</div>
         </a-col>
       </a-row>
       <a-row style="padding-bottom:16px" v-if="info.fxml">
         <a-col :span="24">
           <div class="term" style="color: rgba(0, 0, 0, 0.85)">拟达到的访学目标及预期成果:</div>
           <div class="content" >{{ info.fxml }}</div>
         </a-col>
       </a-row>
       <a-row style="padding-bottom:16px" v-if="info.fxnr">
         <a-col :span="24">
           <div class="term" style="color: rgba(0, 0, 0, 0.85)">访学内容:</div>
           <div class="content" >{{ info.fxnr }}</div>
         </a-col>
       </a-row>
       <a-row style="padding-bottom:16px" v-if="info.jtssbz">
         <a-col :span="24">
           <div class="term" style="color: rgba(0, 0, 0, 0.85)">具体实施步骤:</div>
           <div class="content" >{{ info.jtssbz }}</div>
         </a-col>
       </a-row>
       <a-row style="padding-bottom:16px" v-if="info.bhylylwtmdjzz">
         <a-col :span="24">
           <div class="term" style="color: rgba(0, 0, 0, 0.85)">被会议录用论文题目、第几作者:</div>
           <div class="content" >{{ info.bhylylwtmdjzz }}</div>
         </a-col>
       </a-row>
       <a-row style="padding-bottom:16px" v-if="info.hyqksm">
         <a-col :span="24">
           <div class="term" style="color: rgba(0, 0, 0, 0.85)">会议情况（请简单说明会议的背景情况，在本领域内的层次、学术影响，参加人员，及会议与申请人研究课题内容的关系等）:</div>
           <div class="content" >{{ info.hyqksm }}</div>
         </a-col>
       </a-row>
    <!-- <detail-list :col="1">
      <detail-list-item v-if="info.bsjdkexxxqk" term="博士阶段课程学习情况、科研情况、发表文章及自我综合评价">{{ info.bsjdkexxxqk }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.fxml" term="拟达到的访学目标及预期成果">{{ info.fxml }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.fxnr" term="访学内容">{{ info.fxnr }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.jtssbz" term="具体实施步骤">{{ info.jtssbz }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.bhylylwtmdjzz" term="被会议录用论文题目、第几作者">{{ info.bhylylwtmdjzz }}&nbsp;</detail-list-item>
        <detail-list-item v-if="info.hyqksm" term="会议情况（请简单说明会议的背景情况，在本领域内的层次、学术影响，参加人员，及会议与申请人研究课题内容的关系等）">{{ info.hyqksm }}&nbsp;</detail-list-item>
      </detail-list> -->
      <a-row style="padding-bottom:16px" v-if="info.coursewareLis && info.coursewareLis.length">
        <div class="term" style="color: rgba(0, 0, 0, 0.85)">上传附件:</div>
      <a-upload
        :default-file-list="defaultFileList"
      >
      </a-upload>
      </a-row>
    <template v-if="!show">
    <a-form :form="form">
      <a-row v-if="!type">
        <a-col :span='6'>
        <a-form-item
          label="审核状态"
        >
          <a-select disable v-decorator="['yxshzt',
            {
              rules: [{ required: true, message: '请选择审核状态!' }],
            }]">
            <a-select-option value="05">通过</a-select-option>
            <a-select-option value="06">不通过</a-select-option>
          </a-select>
        </a-form-item>
        </a-col>
      </a-row>
      <a-row v-else >
         <a-col :span='6'>
        <a-form-item
          label="审核状态"
        >
          <a-select disable v-decorator="['yjsyzhbshzt',
            {
              rules: [{ required: true, message: '请选择审核状态!' }],
            }]">
            <a-select-option value="07">通过</a-select-option>
            <a-select-option value="08">不通过</a-select-option>
          </a-select>
        </a-form-item>
         </a-col>
      </a-row>
      <a-row v-if="!type">
        <a-form-item
          :label="info.xmsbId =='5'?'培养单位审核意见：（请说明会议级别及与其他申请人相比的优先程度）':'申请人所在学院（系、所）推荐意见'"
        >
          <a-textarea v-decorator="['yxshyy',
            {
              rules: [{ required: true, message: '请填写审核意见!' }],
            }]"/>
        </a-form-item>
      </a-row>
      <a-row v-else>
        <a-form-item
          label="研究生院意见"
        >
          <a-textarea v-decorator="['yjsyzhbshyy',
            {
              rules: [{ required: true, message: '请填写审核意见!' }],
            }]"/>
        </a-form-item>
      </a-row>
    </a-form>
    </template>
    <template v-else>
      <a-row style="padding-bottom:16px" v-if="info.dsshzt">
         <a-col :span="8">
           <span class="term" style="color: rgba(0, 0, 0, 0.85)">导师审核状态:</span>
           <span>{{info.dsshzt == '03'?'通过':'不通过'}}</span>
         </a-col>
         <a-col :span="16">
           <span class="term" style="color: rgba(0, 0, 0, 0.85)">导师审核意见:</span>
           <span>{{info.dsshyy}}</span>
         </a-col>
       </a-row>
       <a-row style="padding-bottom:16px" v-if="info.yxshzt">
         <a-col :span="8">
           <span class="term" style="color: rgba(0, 0, 0, 0.85)">院系审核状态:</span>
           <span>{{info.yxshzt == '05'?'通过':'不通过'}}</span>
         </a-col>
         <a-col :span="16">
           <span class="term" style="color: rgba(0, 0, 0, 0.85)">院系审核意见:</span>
           <span>{{info.yxshyy}}</span>
         </a-col>
       </a-row>
       <a-row style="padding-bottom:16px" v-if="info.yjsyzhbshzt">
         <a-col :span="8">
           <span class="term" style="color: rgba(0, 0, 0, 0.85)">综合办审核状态:</span>
           <span>{{info.yjsyzhbshzt == '07'?'通过':'不通过'}}</span>
         </a-col>
         <a-col :span="16">
           <span class="term" style="color: rgba(0, 0, 0, 0.85)">综合办审核意见:</span>
           <span>{{info.yjsyzhbshyy}}</span>
         </a-col>
       </a-row>
   <p style="text-align: center" slot="footer" ><a-button type="primary" @click="() => { $emit('cancel') }">关闭</a-button></p>
    </template>
  </a-modal>
</template>

<script>
  import DetailList from '~/tool/DetailList'

  const DetailListItem = DetailList.Item
export default {
  props: ['title', 'visible','type'],
  components: {DetailList, DetailListItem},
  data() {
    return {
      info: {},
      form: this.$form.createForm(this),
      isBatchCheck: false,
      defaultFileList:[],
      show:'',
    }
  },
  watch:{
    info(){
      if(this.info.coursewareLis && this.info.coursewareLis.length){
      this.info.coursewareLis.map(item =>{
        item.name = item.sourceName
        item.uid = item.id
      })
      this.defaultFileList = this.info.coursewareLis
      }
    }
  },
  methods: {
    handleSave() {
      var user = this.$db.get('USER')
      this.form.validateFields((err, values) => {
        if (err) {
          return
        }
        if(!this.type){
        this.$api.student.departSh(Object.assign({id: this.info.id,yxsh:user.qmzd}, values)).then(res => {
          this.$message.success(res.msg)
          this.$emit('cancel')
          this.$emit('refresh')
        })
        }else{
          this.$api.student.graduateSh(Object.assign({id: this.info.id,yjsyzhbsh:user.qmzd}, values)).then(res => {
          this.$message.success(res.msg)
          this.$emit('cancel')
          this.$emit('refresh')
        })
        }
      })
    }
  }
}
</script>

<style>

</style>
